package qldc.pm.tiensu.model.impl;

import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.ProxyUtil;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.model.CacheModel;
import com.liferay.portal.model.impl.BaseModelImpl;
import com.liferay.portal.service.ServiceContext;

import com.liferay.portlet.expando.model.ExpandoBridge;
import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;

import qldc.pm.tiensu.model.BienBanBanGiaoHoSo;
import qldc.pm.tiensu.model.BienBanBanGiaoHoSoModel;

import java.io.Serializable;

import java.sql.Types;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * The base model implementation for the BienBanBanGiaoHoSo service. Represents a row in the &quot;TS_BienBanBanGiaoHoSo&quot; database table, with each column mapped to a property of this class.
 *
 * <p>
 * This implementation and its corresponding interface {@link qldc.pm.tiensu.model.BienBanBanGiaoHoSoModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link BienBanBanGiaoHoSoImpl}.
 * </p>
 *
 * @author Brian Wing Shun Chan
 * @see BienBanBanGiaoHoSoImpl
 * @see qldc.pm.tiensu.model.BienBanBanGiaoHoSo
 * @see qldc.pm.tiensu.model.BienBanBanGiaoHoSoModel
 * @generated
 */
public class BienBanBanGiaoHoSoModelImpl extends BaseModelImpl<BienBanBanGiaoHoSo>
    implements BienBanBanGiaoHoSoModel {
    /*
     * NOTE FOR DEVELOPERS:
     *
     * Never modify or reference this class directly. All methods that expect a bien ban ban giao ho so model instance should use the {@link qldc.pm.tiensu.model.BienBanBanGiaoHoSo} interface instead.
     */
    public static final String TABLE_NAME = "TS_BienBanBanGiaoHoSo";
    public static final Object[][] TABLE_COLUMNS = {
            { "bienBanBanGiaoHoSoId", Types.BIGINT },
            { "kinhGui", Types.VARCHAR },
            { "nguoiLap", Types.VARCHAR },
            { "nguoiDuocBanGiao", Types.VARCHAR },
            { "chucVu", Types.VARCHAR },
            { "chucVuNguoiDuocBanGiao", Types.VARCHAR },
            { "noiDung", Types.VARCHAR },
            { "ngayLap", Types.TIMESTAMP },
            { "ngayBanGiao", Types.TIMESTAMP },
            { "diaDiemBanGiao", Types.VARCHAR }
        };
    public static final String TABLE_SQL_CREATE = "create table TS_BienBanBanGiaoHoSo (bienBanBanGiaoHoSoId LONG not null primary key,kinhGui VARCHAR(200) null,nguoiLap VARCHAR(100) null,nguoiDuocBanGiao VARCHAR(100) null,chucVu VARCHAR(200) null,chucVuNguoiDuocBanGiao VARCHAR(200) null,noiDung STRING null,ngayLap DATE null,ngayBanGiao DATE null,diaDiemBanGiao VARCHAR(75) null)";
    public static final String TABLE_SQL_DROP = "drop table TS_BienBanBanGiaoHoSo";
    public static final String ORDER_BY_JPQL = " ORDER BY bienBanBanGiaoHoSo.bienBanBanGiaoHoSoId DESC";
    public static final String ORDER_BY_SQL = " ORDER BY TS_BienBanBanGiaoHoSo.bienBanBanGiaoHoSoId DESC";
    public static final String DATA_SOURCE = "liferayDataSource";
    public static final String SESSION_FACTORY = "liferaySessionFactory";
    public static final String TX_MANAGER = "liferayTransactionManager";
    public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
                "value.object.entity.cache.enabled.qldc.pm.tiensu.model.BienBanBanGiaoHoSo"),
            true);
    public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
                "value.object.finder.cache.enabled.qldc.pm.tiensu.model.BienBanBanGiaoHoSo"),
            true);
    public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
                "value.object.column.bitmask.enabled.qldc.pm.tiensu.model.BienBanBanGiaoHoSo"),
            true);
    public static long CHUCVUNGUOIDUOCBANGIAO_COLUMN_BITMASK = 1L;
    public static long NGUOIDUOCBANGIAO_COLUMN_BITMASK = 2L;
    public static long BIENBANBANGIAOHOSOID_COLUMN_BITMASK = 4L;
    public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.util.service.ServiceProps.get(
                "lock.expiration.time.qldc.pm.tiensu.model.BienBanBanGiaoHoSo"));
    private static ClassLoader _classLoader = BienBanBanGiaoHoSo.class.getClassLoader();
    private static Class<?>[] _escapedModelInterfaces = new Class[] {
            BienBanBanGiaoHoSo.class
        };
    private long _bienBanBanGiaoHoSoId;
    private String _kinhGui;
    private String _nguoiLap;
    private String _nguoiDuocBanGiao;
    private String _originalNguoiDuocBanGiao;
    private String _chucVu;
    private String _chucVuNguoiDuocBanGiao;
    private String _originalChucVuNguoiDuocBanGiao;
    private String _noiDung;
    private Date _ngayLap;
    private Date _ngayBanGiao;
    private String _diaDiemBanGiao;
    private long _columnBitmask;
    private BienBanBanGiaoHoSo _escapedModel;

    public BienBanBanGiaoHoSoModelImpl() {
    }

    @Override
    public long getPrimaryKey() {
        return _bienBanBanGiaoHoSoId;
    }

    @Override
    public void setPrimaryKey(long primaryKey) {
        setBienBanBanGiaoHoSoId(primaryKey);
    }

    @Override
    public Serializable getPrimaryKeyObj() {
        return _bienBanBanGiaoHoSoId;
    }

    @Override
    public void setPrimaryKeyObj(Serializable primaryKeyObj) {
        setPrimaryKey(((Long) primaryKeyObj).longValue());
    }

    @Override
    public Class<?> getModelClass() {
        return BienBanBanGiaoHoSo.class;
    }

    @Override
    public String getModelClassName() {
        return BienBanBanGiaoHoSo.class.getName();
    }

    @Override
    public Map<String, Object> getModelAttributes() {
        Map<String, Object> attributes = new HashMap<String, Object>();

        attributes.put("bienBanBanGiaoHoSoId", getBienBanBanGiaoHoSoId());
        attributes.put("kinhGui", getKinhGui());
        attributes.put("nguoiLap", getNguoiLap());
        attributes.put("nguoiDuocBanGiao", getNguoiDuocBanGiao());
        attributes.put("chucVu", getChucVu());
        attributes.put("chucVuNguoiDuocBanGiao", getChucVuNguoiDuocBanGiao());
        attributes.put("noiDung", getNoiDung());
        attributes.put("ngayLap", getNgayLap());
        attributes.put("ngayBanGiao", getNgayBanGiao());
        attributes.put("diaDiemBanGiao", getDiaDiemBanGiao());

        return attributes;
    }

    @Override
    public void setModelAttributes(Map<String, Object> attributes) {
        Long bienBanBanGiaoHoSoId = (Long) attributes.get(
                "bienBanBanGiaoHoSoId");

        if (bienBanBanGiaoHoSoId != null) {
            setBienBanBanGiaoHoSoId(bienBanBanGiaoHoSoId);
        }

        String kinhGui = (String) attributes.get("kinhGui");

        if (kinhGui != null) {
            setKinhGui(kinhGui);
        }

        String nguoiLap = (String) attributes.get("nguoiLap");

        if (nguoiLap != null) {
            setNguoiLap(nguoiLap);
        }

        String nguoiDuocBanGiao = (String) attributes.get("nguoiDuocBanGiao");

        if (nguoiDuocBanGiao != null) {
            setNguoiDuocBanGiao(nguoiDuocBanGiao);
        }

        String chucVu = (String) attributes.get("chucVu");

        if (chucVu != null) {
            setChucVu(chucVu);
        }

        String chucVuNguoiDuocBanGiao = (String) attributes.get(
                "chucVuNguoiDuocBanGiao");

        if (chucVuNguoiDuocBanGiao != null) {
            setChucVuNguoiDuocBanGiao(chucVuNguoiDuocBanGiao);
        }

        String noiDung = (String) attributes.get("noiDung");

        if (noiDung != null) {
            setNoiDung(noiDung);
        }

        Date ngayLap = (Date) attributes.get("ngayLap");

        if (ngayLap != null) {
            setNgayLap(ngayLap);
        }

        Date ngayBanGiao = (Date) attributes.get("ngayBanGiao");

        if (ngayBanGiao != null) {
            setNgayBanGiao(ngayBanGiao);
        }

        String diaDiemBanGiao = (String) attributes.get("diaDiemBanGiao");

        if (diaDiemBanGiao != null) {
            setDiaDiemBanGiao(diaDiemBanGiao);
        }
    }

    @Override
    public long getBienBanBanGiaoHoSoId() {
        return _bienBanBanGiaoHoSoId;
    }

    @Override
    public void setBienBanBanGiaoHoSoId(long bienBanBanGiaoHoSoId) {
        _columnBitmask = -1L;

        _bienBanBanGiaoHoSoId = bienBanBanGiaoHoSoId;
    }

    @Override
    public String getKinhGui() {
        if (_kinhGui == null) {
            return StringPool.BLANK;
        } else {
            return _kinhGui;
        }
    }

    @Override
    public void setKinhGui(String kinhGui) {
        _kinhGui = kinhGui;
    }

    @Override
    public String getNguoiLap() {
        if (_nguoiLap == null) {
            return StringPool.BLANK;
        } else {
            return _nguoiLap;
        }
    }

    @Override
    public void setNguoiLap(String nguoiLap) {
        _nguoiLap = nguoiLap;
    }

    @Override
    public String getNguoiDuocBanGiao() {
        if (_nguoiDuocBanGiao == null) {
            return StringPool.BLANK;
        } else {
            return _nguoiDuocBanGiao;
        }
    }

    @Override
    public void setNguoiDuocBanGiao(String nguoiDuocBanGiao) {
        _columnBitmask |= NGUOIDUOCBANGIAO_COLUMN_BITMASK;

        if (_originalNguoiDuocBanGiao == null) {
            _originalNguoiDuocBanGiao = _nguoiDuocBanGiao;
        }

        _nguoiDuocBanGiao = nguoiDuocBanGiao;
    }

    public String getOriginalNguoiDuocBanGiao() {
        return GetterUtil.getString(_originalNguoiDuocBanGiao);
    }

    @Override
    public String getChucVu() {
        if (_chucVu == null) {
            return StringPool.BLANK;
        } else {
            return _chucVu;
        }
    }

    @Override
    public void setChucVu(String chucVu) {
        _chucVu = chucVu;
    }

    @Override
    public String getChucVuNguoiDuocBanGiao() {
        if (_chucVuNguoiDuocBanGiao == null) {
            return StringPool.BLANK;
        } else {
            return _chucVuNguoiDuocBanGiao;
        }
    }

    @Override
    public void setChucVuNguoiDuocBanGiao(String chucVuNguoiDuocBanGiao) {
        _columnBitmask |= CHUCVUNGUOIDUOCBANGIAO_COLUMN_BITMASK;

        if (_originalChucVuNguoiDuocBanGiao == null) {
            _originalChucVuNguoiDuocBanGiao = _chucVuNguoiDuocBanGiao;
        }

        _chucVuNguoiDuocBanGiao = chucVuNguoiDuocBanGiao;
    }

    public String getOriginalChucVuNguoiDuocBanGiao() {
        return GetterUtil.getString(_originalChucVuNguoiDuocBanGiao);
    }

    @Override
    public String getNoiDung() {
        if (_noiDung == null) {
            return StringPool.BLANK;
        } else {
            return _noiDung;
        }
    }

    @Override
    public void setNoiDung(String noiDung) {
        _noiDung = noiDung;
    }

    @Override
    public Date getNgayLap() {
        return _ngayLap;
    }

    @Override
    public void setNgayLap(Date ngayLap) {
        _ngayLap = ngayLap;
    }

    @Override
    public Date getNgayBanGiao() {
        return _ngayBanGiao;
    }

    @Override
    public void setNgayBanGiao(Date ngayBanGiao) {
        _ngayBanGiao = ngayBanGiao;
    }

    @Override
    public String getDiaDiemBanGiao() {
        if (_diaDiemBanGiao == null) {
            return StringPool.BLANK;
        } else {
            return _diaDiemBanGiao;
        }
    }

    @Override
    public void setDiaDiemBanGiao(String diaDiemBanGiao) {
        _diaDiemBanGiao = diaDiemBanGiao;
    }

    public long getColumnBitmask() {
        return _columnBitmask;
    }

    @Override
    public ExpandoBridge getExpandoBridge() {
        return ExpandoBridgeFactoryUtil.getExpandoBridge(0,
            BienBanBanGiaoHoSo.class.getName(), getPrimaryKey());
    }

    @Override
    public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
        ExpandoBridge expandoBridge = getExpandoBridge();

        expandoBridge.setAttributes(serviceContext);
    }

    @Override
    public BienBanBanGiaoHoSo toEscapedModel() {
        if (_escapedModel == null) {
            _escapedModel = (BienBanBanGiaoHoSo) ProxyUtil.newProxyInstance(_classLoader,
                    _escapedModelInterfaces, new AutoEscapeBeanHandler(this));
        }

        return _escapedModel;
    }

    @Override
    public Object clone() {
        BienBanBanGiaoHoSoImpl bienBanBanGiaoHoSoImpl = new BienBanBanGiaoHoSoImpl();

        bienBanBanGiaoHoSoImpl.setBienBanBanGiaoHoSoId(getBienBanBanGiaoHoSoId());
        bienBanBanGiaoHoSoImpl.setKinhGui(getKinhGui());
        bienBanBanGiaoHoSoImpl.setNguoiLap(getNguoiLap());
        bienBanBanGiaoHoSoImpl.setNguoiDuocBanGiao(getNguoiDuocBanGiao());
        bienBanBanGiaoHoSoImpl.setChucVu(getChucVu());
        bienBanBanGiaoHoSoImpl.setChucVuNguoiDuocBanGiao(getChucVuNguoiDuocBanGiao());
        bienBanBanGiaoHoSoImpl.setNoiDung(getNoiDung());
        bienBanBanGiaoHoSoImpl.setNgayLap(getNgayLap());
        bienBanBanGiaoHoSoImpl.setNgayBanGiao(getNgayBanGiao());
        bienBanBanGiaoHoSoImpl.setDiaDiemBanGiao(getDiaDiemBanGiao());

        bienBanBanGiaoHoSoImpl.resetOriginalValues();

        return bienBanBanGiaoHoSoImpl;
    }

    @Override
    public int compareTo(BienBanBanGiaoHoSo bienBanBanGiaoHoSo) {
        int value = 0;

        if (getBienBanBanGiaoHoSoId() < bienBanBanGiaoHoSo.getBienBanBanGiaoHoSoId()) {
            value = -1;
        } else if (getBienBanBanGiaoHoSoId() > bienBanBanGiaoHoSo.getBienBanBanGiaoHoSoId()) {
            value = 1;
        } else {
            value = 0;
        }

        value = value * -1;

        if (value != 0) {
            return value;
        }

        return 0;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }

        if (!(obj instanceof BienBanBanGiaoHoSo)) {
            return false;
        }

        BienBanBanGiaoHoSo bienBanBanGiaoHoSo = (BienBanBanGiaoHoSo) obj;

        long primaryKey = bienBanBanGiaoHoSo.getPrimaryKey();

        if (getPrimaryKey() == primaryKey) {
            return true;
        } else {
            return false;
        }
    }

    @Override
    public int hashCode() {
        return (int) getPrimaryKey();
    }

    @Override
    public void resetOriginalValues() {
        BienBanBanGiaoHoSoModelImpl bienBanBanGiaoHoSoModelImpl = this;

        bienBanBanGiaoHoSoModelImpl._originalNguoiDuocBanGiao = bienBanBanGiaoHoSoModelImpl._nguoiDuocBanGiao;

        bienBanBanGiaoHoSoModelImpl._originalChucVuNguoiDuocBanGiao = bienBanBanGiaoHoSoModelImpl._chucVuNguoiDuocBanGiao;

        bienBanBanGiaoHoSoModelImpl._columnBitmask = 0;
    }

    @Override
    public CacheModel<BienBanBanGiaoHoSo> toCacheModel() {
        BienBanBanGiaoHoSoCacheModel bienBanBanGiaoHoSoCacheModel = new BienBanBanGiaoHoSoCacheModel();

        bienBanBanGiaoHoSoCacheModel.bienBanBanGiaoHoSoId = getBienBanBanGiaoHoSoId();

        bienBanBanGiaoHoSoCacheModel.kinhGui = getKinhGui();

        String kinhGui = bienBanBanGiaoHoSoCacheModel.kinhGui;

        if ((kinhGui != null) && (kinhGui.length() == 0)) {
            bienBanBanGiaoHoSoCacheModel.kinhGui = null;
        }

        bienBanBanGiaoHoSoCacheModel.nguoiLap = getNguoiLap();

        String nguoiLap = bienBanBanGiaoHoSoCacheModel.nguoiLap;

        if ((nguoiLap != null) && (nguoiLap.length() == 0)) {
            bienBanBanGiaoHoSoCacheModel.nguoiLap = null;
        }

        bienBanBanGiaoHoSoCacheModel.nguoiDuocBanGiao = getNguoiDuocBanGiao();

        String nguoiDuocBanGiao = bienBanBanGiaoHoSoCacheModel.nguoiDuocBanGiao;

        if ((nguoiDuocBanGiao != null) && (nguoiDuocBanGiao.length() == 0)) {
            bienBanBanGiaoHoSoCacheModel.nguoiDuocBanGiao = null;
        }

        bienBanBanGiaoHoSoCacheModel.chucVu = getChucVu();

        String chucVu = bienBanBanGiaoHoSoCacheModel.chucVu;

        if ((chucVu != null) && (chucVu.length() == 0)) {
            bienBanBanGiaoHoSoCacheModel.chucVu = null;
        }

        bienBanBanGiaoHoSoCacheModel.chucVuNguoiDuocBanGiao = getChucVuNguoiDuocBanGiao();

        String chucVuNguoiDuocBanGiao = bienBanBanGiaoHoSoCacheModel.chucVuNguoiDuocBanGiao;

        if ((chucVuNguoiDuocBanGiao != null) &&
                (chucVuNguoiDuocBanGiao.length() == 0)) {
            bienBanBanGiaoHoSoCacheModel.chucVuNguoiDuocBanGiao = null;
        }

        bienBanBanGiaoHoSoCacheModel.noiDung = getNoiDung();

        String noiDung = bienBanBanGiaoHoSoCacheModel.noiDung;

        if ((noiDung != null) && (noiDung.length() == 0)) {
            bienBanBanGiaoHoSoCacheModel.noiDung = null;
        }

        Date ngayLap = getNgayLap();

        if (ngayLap != null) {
            bienBanBanGiaoHoSoCacheModel.ngayLap = ngayLap.getTime();
        } else {
            bienBanBanGiaoHoSoCacheModel.ngayLap = Long.MIN_VALUE;
        }

        Date ngayBanGiao = getNgayBanGiao();

        if (ngayBanGiao != null) {
            bienBanBanGiaoHoSoCacheModel.ngayBanGiao = ngayBanGiao.getTime();
        } else {
            bienBanBanGiaoHoSoCacheModel.ngayBanGiao = Long.MIN_VALUE;
        }

        bienBanBanGiaoHoSoCacheModel.diaDiemBanGiao = getDiaDiemBanGiao();

        String diaDiemBanGiao = bienBanBanGiaoHoSoCacheModel.diaDiemBanGiao;

        if ((diaDiemBanGiao != null) && (diaDiemBanGiao.length() == 0)) {
            bienBanBanGiaoHoSoCacheModel.diaDiemBanGiao = null;
        }

        return bienBanBanGiaoHoSoCacheModel;
    }

    @Override
    public String toString() {
        StringBundler sb = new StringBundler(21);

        sb.append("{bienBanBanGiaoHoSoId=");
        sb.append(getBienBanBanGiaoHoSoId());
        sb.append(", kinhGui=");
        sb.append(getKinhGui());
        sb.append(", nguoiLap=");
        sb.append(getNguoiLap());
        sb.append(", nguoiDuocBanGiao=");
        sb.append(getNguoiDuocBanGiao());
        sb.append(", chucVu=");
        sb.append(getChucVu());
        sb.append(", chucVuNguoiDuocBanGiao=");
        sb.append(getChucVuNguoiDuocBanGiao());
        sb.append(", noiDung=");
        sb.append(getNoiDung());
        sb.append(", ngayLap=");
        sb.append(getNgayLap());
        sb.append(", ngayBanGiao=");
        sb.append(getNgayBanGiao());
        sb.append(", diaDiemBanGiao=");
        sb.append(getDiaDiemBanGiao());
        sb.append("}");

        return sb.toString();
    }

    @Override
    public String toXmlString() {
        StringBundler sb = new StringBundler(34);

        sb.append("<model><model-name>");
        sb.append("qldc.pm.tiensu.model.BienBanBanGiaoHoSo");
        sb.append("</model-name>");

        sb.append(
            "<column><column-name>bienBanBanGiaoHoSoId</column-name><column-value><![CDATA[");
        sb.append(getBienBanBanGiaoHoSoId());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>kinhGui</column-name><column-value><![CDATA[");
        sb.append(getKinhGui());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>nguoiLap</column-name><column-value><![CDATA[");
        sb.append(getNguoiLap());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>nguoiDuocBanGiao</column-name><column-value><![CDATA[");
        sb.append(getNguoiDuocBanGiao());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>chucVu</column-name><column-value><![CDATA[");
        sb.append(getChucVu());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>chucVuNguoiDuocBanGiao</column-name><column-value><![CDATA[");
        sb.append(getChucVuNguoiDuocBanGiao());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>noiDung</column-name><column-value><![CDATA[");
        sb.append(getNoiDung());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>ngayLap</column-name><column-value><![CDATA[");
        sb.append(getNgayLap());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>ngayBanGiao</column-name><column-value><![CDATA[");
        sb.append(getNgayBanGiao());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>diaDiemBanGiao</column-name><column-value><![CDATA[");
        sb.append(getDiaDiemBanGiao());
        sb.append("]]></column-value></column>");

        sb.append("</model>");

        return sb.toString();
    }
}
